/*
 * Copyright (C) 2013 Will Dignazio
 */
#include "internal.h"
#include <stdio.h>
#include <fuse.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>

int
fuse_create(const char* path, mode_t mode, struct fuse_file_info* info)
{
	UCache *ucache;
	UCacheObj *obj;

	ucache = getinstance();
	if(ucache == NULL)
		return -1;

	obj = allocobj(0, ucache);
	if(obj == NULL)
		return -1;

	
	return 0;
}

int
fuse_fgetattr(const char* path, struct stat* statbuf)
{
	int r;

	r = 0;
	memset(statbuf, 0, sizeof(struct stat));
	if(strcmp(path, "/") == 0) {
		statbuf->st_mode = S_IFDIR | 0755; 
		statbuf->st_nlink = 2;
	} else {
		return -ENOENT;
	}
	
	return r;
}

int
fuse_freaddir(const char* path, void* buf, fuse_fill_dir_t filler,
	      off_t offset, struct fuse_file_info* finfo)
{
	(void)offset;
	(void)finfo;

	if(strcmp(path, "/") != 0)
		return -ENOENT;

	filler(buf, ".", NULL, 0);
	filler(buf, "..", NULL, 0);
	
	return 0;
};
